<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 200px;
            height: 200px;
            border: 2px solid red;
            position: relative;
        }
        .box img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .box::after {
            content: "";
            /* display: block; */
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0);
            position: absolute;
            left: 0;
            top:0;
            transition: background-color 0.5s ease;
        }

        .box:hover::after {
            background-color: rgba(0, 0, 0, 0.5);
        }
    </style>
</head>
<body>
    <div class="box">
        <img src="./assets/head3.jpg" alt="">
    </div>
</body>
</html>